/*
 * Copyright (c) 2020 pie4cloud Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pie4cloud.pie.admin.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pie4cloud.pie.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 菜单权限表
 * </p>
 *
 * @author zzj
 * @since 2019/2/1
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "SYS_MENU")
public class SysMenu extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 菜单ID
	 */
	@Id
	@Column(name = "MENU_ID",length = 11)
	@TableId(value = "menu_id", type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "菜单id")
	private Long menuId;

	/**
	 * 菜单名称
	 */
	@NotBlank(message = "菜单名称不能为空")
	@ApiModelProperty(value = "菜单名称")
	@Column(name = "NAME",length = 32)
	private String name;

	@Column(name = "COMPONENT",length = 64)
	private String component;


	/**
	 * 菜单权限标识
	 */
	@ApiModelProperty(value = "菜单权限标识")
	@Column(name = "PERMISSION",length = 32)
	private String permission;

	/**
	 * 父菜单ID
	 */
	@NotNull(message = "菜单父ID不能为空")
	@ApiModelProperty(value = "菜单父id")
	@Column(name = "PARENT_ID",length = 11)
	private Long parentId;

	/**
	 * 图标
	 */
	@ApiModelProperty(value = "菜单图标")
	@Column(name = "ICON",length = 32)
	private String icon;

	/**
	 * 前端URL
	 */
	@ApiModelProperty(value = "前端路由标识路径")
	@Column(name = "PATH",length = 128)
	private String path;

	/**
	 * 排序值
	 */
	@ApiModelProperty(value = "排序值")
	@Column(name = "SORT",length = 11,columnDefinition = "INTEGER default 0")
	private Integer sort;

	/**
	 * 菜单类型 （0菜单 1按钮）
	 */
	@NotNull(message = "菜单类型不能为空")
	@Column(name = "TYPE",length = 1)
	private String type;

	/**
	 * 路由缓冲
	 */
	@ApiModelProperty(value = "路由缓冲")
	@Column(name = "KEEP_ALIVE",length = 1)
	private String keepAlive;

	/**
	 * 0--正常 1--删除
	 */
	@TableLogic
	@Column(name = "DEL_FLAG",length = 1,columnDefinition = "VARCHAR(1) DEFAULT '0'")
	private String delFlag;

}
